package com.fzfnn.scrapbook.controller;

import com.fzfnn.scrapbook.entity.Journal;
import com.fzfnn.scrapbook.service.SearchService;
import com.fzfnn.scrapbook.util.R;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;


@RestController
@RequestMapping("/search")
@Tag(name = "搜索接口")

public class SearchController {
    @Autowired
    private SearchService searchService;
    @GetMapping("/journal")
    @Operation(summary = "模糊搜索手账")
    public R search(@RequestParam String keyword) {
        return R.successData(searchService.searchJournals(keyword));
    }
    @GetMapping("/search")
    @Operation(summary = "模糊搜索用户")
    public R searchUsers(@RequestParam String keyword) {
        return R.success("搜索成功", searchService.searchUser(keyword));
    }
}
